Living Worlds

GPU-Accelerated Terrain Simulation

CS380 Final Presentation

Mohammad Alkhalifah
December 2025

The Problem

Static Terrain is Boring

  • Traditional approach: Offline generation or manual sculpting
  • Games need: Dynamic, evolving worlds

Our Goal

Real-time terrain simulation using GPU cellular automata
with interactive framerates

What We Built

Living Worlds Engine

Component Description
Geological Layer Thermal erosion simulation
Ecological Layer 9 biome types with spreading rules
Feedback Loop Forests stabilize terrain (80% resistance)
Renderer 2.5D isometric with atmospheric fog

GPU Architecture

Data Flow

Heightmap A ──► Erosion ──► Heightmap B
    ↑                          │
    └────── Ping-Pong ─────────┘

Biome A ────► Biome CA ──► Biome B
    ↑                          │
    └────── Ping-Pong ─────────┘

Why Ping-Pong?

  • Prevents race conditions in parallel updates
  • Each frame: Read A → Write B → Swap
  • Essential for cellular automata correctness

Cellular Automata Rules

Erosion (Diffusion)

Each cell moves toward neighbor average

float neighborAvg = avgOf8Neighbors();
newH = h + (neighborAvg - h) * rate;

Biome Feedback

Biomes modify erosion rate

if (biome == FOREST) 
    rate *= forestMult; // UI: 0.2
if (biome == DESERT) 
    rate *= desertMult; // UI: 1.5

Biome Spreading

Height thresholds + neighbor counting

if (h < 0.30) biome = WATER;
if (h > 0.85) biome = SNOW;
if (forestNeighbors >= threshold)
    if (rand() < forestChance)
        biome = FOREST;

Why Compute Shaders?

  • Parallel: 9.4M threads
  • Local: No global sync needed

Biome System

9 Discrete Biome Types

Biome Behavior
🌊 Water Height < 0.3 (forced)
🏖️ Sand Coastal zones
🌱 Grass Default land, converts to forest
🌲 Forest Spreads, resists erosion
🏜️ Desert Spreads in dry areas
🪨 Rock High elevation (>0.8)
❄️ Snow Peaks (>0.85)
🏔️ Tundra Alpine transition
💧 Wetland Low areas near water

Performance Results

Benchmark: FPS vs Grid Size

Grid Vertices FPS
512² 262K 3,062
1024² 1.0M 1,414
2048² 4.2M 505
3072² 9.4M 243

Scalability Analysis

FPS vs Simulation Speed

Key Findings

  • FPS decreases linearly with compute load
  • 1000× sim speed costs ~30% FPS
  • Interactive performance maintained

Demo Video

Walkthrough

Terrain generation, camera control, biome spawning, real-time CA parameter changes, and erosion dynamics.

Future Work

  • Hydraulic erosion - water flow simulation
  • Infinite terrain - chunked streaming
  • Advanced lighting - shadows, ambient occlusion

Thank You!

Questions?

Repository:
github.com/mkhlf/livingworlds

Slide 6: Reduced font size for table fit